class check_file(Exception):
    def __init__(self,err='只支持,jpg,png,jpeg格式的文件'):
        super().__init__(err)

try:
    allowed_extensions = ['jpg', 'png', 'jpeg']
    filename=str(input("请上传头像："))
    if filename.split('.')[-1] in allowed_extensions:
        print("上传成功")
    else:
        raise check_file
except Exception as e:
    print(e)
